package com.zhentao.mapper;

import com.zhentao.domain.SysBattery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author 86133
 * @description 针对表【sys_battery】的数据库操作Mapper
 * @createDate 2024-08-27 21:33:19
 * @Entity com.zhentao.domain.SysBattery
 */
public interface SysBatteryMapper extends BaseMapper<SysBattery> {
    //    查询电池展示及类型列表
    @Select("select * from sys_battery sb left join sys_battery_type sbt on sb.battery_type = sbt.id")
    @Results(id = "list", value = {
            @Result(column = "id", property = "id"),
            @Result(column = "battery_name", property = "batteryName"),
            @Result(column = "battery_brand", property = "batteryBrand"),
            @Result(column = "battery_endurance", property = "batteryEndurance"),
            @Result(column = "battery_type", property = "batteryType"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "battery_price", property = "batteryPrice"),
            @Result(column = "battery_type", property = "batteryTypeName", javaType = String.class, one = @One(select = "com.zhentao.mapper.SysBatteryTypeMapper.getBatteryTypeName", fetchType = FetchType.EAGER))
    })
    List<SysBattery> getBatteryList();
}




